import Http from "../../utils/HttpUtil";
import URL from "../URL";
export default{
    //查询课件目录列表
    async  SelectCoursewareChapterList(page=1){
        let url=URL.GetURL(URL.CoursewareSelectCoursewareChapterList);
        return await(Http.Get(url+"?page="+page))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //查询课件目录章节列表
    async  SelectCoursewareSectionSList(chapterId){
        let url=URL.GetURL(URL.CoursewareSelectCoursewareSectionSList);
        return await(Http.Get(url+"?chapterId="+chapterId))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //查询课件目录节详情
    async  SelectCoursewareSectionSDetails(sectionId){
        let url=URL.GetURL(URL.CoursewareSelectCoursewareSectionSDetails);
        return await(Http.Get(url+"?sectionId="+sectionId))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //分享解锁课件
    async  UnlockCourseware(userId,chapterNumber){
        let url=URL.GetURL(URL.CoursewareUnlockCourseware);
        let para={userId,chapterNumber};
        return await(Http.Post(url,para))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //查看课件已解锁的目录
    async SelectUnlockCourseware(userId){
        let url=URL.GetURL(URL.CoursewareSelectUnlockCourseware);
        return await(Http.Get(url+"?userId="+userId))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //查看课件已解锁的目录
    async CoursewareCoursewareBuy(userId,payPassword){
        let url=URL.GetURL(URL.CoursewareCoursewareBuy);
        let para={
            userId,payPassword
        };
        return await(Http.Post(url,para))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },
    
}